/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.wii.elpro.dao.hb;

import com.wii.elpro.dao.HibernateUtil;
import com.wii.elpro.dao.JenisDAOInterface;
import com.wii.elpro.entity.Jenis;
import java.util.List;
import org.hibernate.Session;

/**
 *
 * @author hendro
 */
public class JenisDAOImpl extends DAOGenericImpl implements JenisDAOInterface {

    public Jenis getJenis(long id) throws Exception {
        HibernateUtil.beginTransaction();
        Session em = HibernateUtil.getSession();
        try {
            return (Jenis)em.load(Jenis.class, id);
        } catch (Exception ex) {
            throw ex;
        }
    }

    public List<Jenis> getJeniss() throws Exception {
        HibernateUtil.beginTransaction();
        Session em = HibernateUtil.getSession();
        try {
            return em.createQuery("SELECT d FROM Jenis d").list();
        } catch (Exception ex) {
            throw ex;
        }
    }
    
}
